﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="cert.aspx.cs" Inherits="member_cert" %>

	<link rel="stylesheet" href="/Public/Home/chosen_v1.5.1/chosen.css" />
	<link rel="stylesheet" href="/Public/Home/css/colorbox.css" />
	<style type="text/css">
		<!--
		.QiyeC a{border:1px solid #d2ccc4;color:#666;padding: 3px 10px;display:inline-block;margin:5px 0;}
		#delImage{display: block; position: absolute;bottom:5px;right:5px;background:#e95515;border:none;color:#FFF;overflow:visible;padding:5px 10px;cursor:pointer;}
		.alert-warning{
			position:relative;
			margin:0 30px 15px;
			padding:25px;
			color:#a94442;
			background-color:#f2dede;
			border:1px solid #ebccd1;
			border-radius:4px;
		}
		.alert-warning .close{
			position:absolute;
			top:25px;
			right:25px;
		}
        .listbox{margin:10px 0 0 15px;}
		-->
	</style>
	<div class="Member_content">
		<h1 class="member_iconTit">
			批件管理
		</h1>
		<h2 class="jies">说明：
			<br />1、文件上传、扫描上传、拍照上传支持所有浏览器，拍照上传推荐使用firefox、chrome、360极速等支持HTM5的浏览器。
			<br />2、点击档案号可直接修改。
			<br />3、采购单据号和销售单据号不能同时查询
			<br />4、为了保证批件的存储质量，请上传1240*1754及以上分辨率的图片
		</h2>
        <form id="form1" runat="server">
				<div class="msearch">		
			<span class="s1">
				<b>其他信息</b>
                <asp:textbox ID="k" width="140px" runat="server" placeholder="编号/名称/拼音码"></asp:textbox>
			</span>
			<span class="s1">
				<b>生产厂家</b>
                <asp:textbox ID="cj" width="160px" runat="server" placeholder="生产厂家"></asp:textbox>
			</span>
			<span class="s1" style="margin:0 10px 0 -10px;">
				<b style="width:48px;">上传状态</b>
                <asp:dropdownlist CssClass="listbox" ID="f" runat="server">
                    <asp:ListItem Text="全部" Value="0" selected="true"></asp:ListItem>
                    <asp:ListItem Text="未上传" Value="1"></asp:ListItem>
                    <asp:ListItem Text="已上传" Value="2"></asp:ListItem>
                </asp:dropdownlist>
			</span>
            <span class="s1" style="margin:0 10px 0 -10px;">
				<b style="width:48px;">类别</b>
                <asp:dropdownlist CssClass="listbox" ID="ddlleibie" runat="server" OnSelectedIndexChanged="DropDownList2_SelectedIndexChanged">
                        <asp:ListItem>全部</asp:ListItem>
                </asp:dropdownlist>
			</span>
                <asp:button runat="server" CssClass="msbut submit-search" text="搜  索" OnClick="Submit_Click" />						
		</div>
		<div class="mbig"> 
            <asp:literal ID="ResultDeBug" runat="server"></asp:literal>     
                          <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" GridLines="None" Width="100%" CellPadding="0" PageSize="9" CssClass="sebig" AllowPaging="true"  onpageindexchanging="GridView1_PageIndexChanging" >
                        <Columns>
                          <asp:BoundField DataField="spid" HeaderText="商品ID" />
                          <asp:BoundField DataField="bh" HeaderText="档案号" />
                          <asp:BoundField DataField="spbh" HeaderText="商品编号" />
                          <asp:BoundField DataField="spmch" HeaderText="商品名称" />
                          <asp:BoundField DataField="shpgg" HeaderText="规格" />
                          <asp:BoundField DataField="dw" HeaderText="单位" />
                          <asp:BoundField DataField="pizhwh" HeaderText="批准文号" />
                          <asp:BoundField DataField="shengccj" HeaderText="生产厂家" />
                          <asp:TemplateField  HeaderText="上传状态">
                             <ItemTemplate>
                                <a class="ajax-url" href="/member/drug/act/chflag/id/5b9a1c58280f4207e21715ff/flag/1.html" data-msg="确定要将该批件标记为已上传状态吗？" title="点击可标记为已上传状态">未上传</a>
                             </ItemTemplate>
                          </asp:TemplateField>
                            <asp:BoundField HtmlEncode="false" DataField="pj" HeaderText="批件"/> 
                        </Columns>
                        <RowStyle CssClass="searli" />
                        <HeaderStyle CssClass="setit" />
                    <PagerTemplate>
                        <div class="bot">
				        <h1 class="fl s2">&nbsp;</h1>
	        <ul class="fr s2"><li class="pageList"><asp:LinkButton ID="LinkButtonPreviousPage" runat="server" CommandArgument="Prev"
                                        CommandName="Page" Visible='<%# ((GridView)Container.NamingContainer).PageIndex != 0 %>'>上一页</asp:LinkButton> 
                <asp:LinkButton ID="LinkButtonFirstPage" runat="server" CommandArgument="First" CommandName="Page"
                                        Visible='<%#((GridView)Container.NamingContainer).PageIndex != 0 %>'>首页</asp:LinkButton>                 
                <asp:TextBox ID="TextBox1" runat="server" Width="20px" Text='<%# ((GridView)Container.Parent.Parent).PageIndex + 1 %>' style="float:left;width:40px;height:30px;line-height:30px;border:1px solid #e5e5e5;text-align:center;margin:0 -1px 0 3px;" />
                <input type="submit" style="height:32px;line-height:32px;float:left;width:40px;" value="跳转" /> 
                <asp:LinkButton ID="LinkButton1" runat="server" CommandArgument="Last" CommandName="Page"
                                        Visible='<%# ((GridView)Container.NamingContainer).PageIndex != ((GridView)Container.NamingContainer).PageCount - 1 %>'>尾页</asp:LinkButton> 
                <asp:LinkButton ID="LinkButtonNextPage" runat="server" CommandArgument="Next" CommandName="Page"
                                        Visible='<%# ((GridView)Container.NamingContainer).PageIndex != ((GridView)Container.NamingContainer).PageCount - 1 %>'>下一页</asp:LinkButton> 
                <a href="javascript:;">共 <%# ((GridView)Container.NamingContainer).Rows.Count%> 条记录，
                    第 <asp:Literal ID="LabelCurrentPage" runat="server" Text="<%# ((GridView)Container.NamingContainer).PageIndex + 1 %>"></asp:Literal>/<asp:Literal ID="LabelPageCount" runat="server" Text="<%# ((GridView)Container.NamingContainer).PageCount%>"></asp:Literal> 页</a></li></ul>
	    </div>
            </PagerTemplate>
                    </asp:GridView>
            <asp:literal ID="listpager" runat="server"></asp:literal>
			</div>
        </form>
	</div>
	<script src="/Public/Home/chosen_v1.5.1/chosen.jquery.js" type="text/javascript"></script>
	<script src="/Public/Home/js/jquery.colorbox.js" type="text/javascript"></script>
	<script src="/Public/Home/js/jqueryui.js" type="text/javascript"></script>
	<script src="/Public/Home/js/jquery.mousewheel.min.js" type="text/javascript"></script>
	<script src="/Public/Home/js/jquery.iviewer.min.js" type="text/javascript"></script>
	<script type="text/javascript" src="/Public/Home/js/My97DatePicker/WdatePicker.js"></script>
	<script type="text/javascript">
	    $(function () {
	        $('#search-from').keyup(function (event) {
	            if (event.keyCode == 13) {
	                $('#export').val('0');
	                $('#search-from').submit();
	            }
	        }).on('click', '.submit-search', function () {
	            $('#export').val($(this).attr('data-type'));
	            $('#search-from').submit();
	        });

	        $('select').chosen({ disable_search: true, width: '132px' });
	        $('.view').colorbox({ width: '80%', height: '100%', current: "{current}/{total}" });
	        $(document).bind('cbox_complete', function () {
	            var image_id = $.colorbox.element().attr('rel');
	            var image_url = $.colorbox.element().attr('href');
	            var data_dap = $.colorbox.element().attr('data-dap');
	            var data_img = $.colorbox.element().attr('data-img');
	            $("#cboxLoadedContent").iviewer({
	                src: image_url, onFinishLoad: function () {
	                    $(this).append('<div class="iviewer_common iviewer_button btn-image-delete"  data_img="' + data_img + '"  data-dap="' + data_dap + '" data-id="' + image_id + '" data-url="' + image_url + '">删除该张批件</div>');
	                }
	            }).find('img.cboxPhoto').remove();
	        });
	        $('#colorbox').on('click', '.btn-image-delete', function () {
	            var id = $(this).attr('data-id');
	            var src = $(this).attr('data-url');
	            var dap = $(this).attr('data-dap');
	            var img = $(this).attr('data_img');
	            if (confirm("确定要删除该批件图片吗？")) {
	                $.ajax({
	                    url: '/member/delfile.ashx',
	                    type: "post",
	                    data: { file: src, id: id, dap: dap, img: img },
	                    dataType: 'json',
	                    success: function (data) {
	                        alert(data.msg ? data.msg : '抱歉，系统错误，请稍后再试！');
	                        if (data.code == 1) {
	                            window.location.reload();
	                        }
	                        return false;
	                    },
	                    error: function () {
	                        alert('抱歉，系统错误，请稍后再试！');
	                    }
	                });
	            }
	        });
	        $(".upload").on('click', function () {
	            var $obj = $(this);
	            var id = $obj.attr('data-id');
	            var fb = $(this).attr('data-dap');
	            var url = '/base/drugupload.aspx';
	            $.dialog({
	                title: '批件上传',
	                width: 965,
	                height: 533,
	                content: 'url:' + url + '?id=' + id + '&fb=' + fb,
	                padding: 0,
	                lock: true,
	                fixed: true,
	                min: false,
	                max: false,
	                close: function () {
	                    if (this.iframe.contentWindow.dcsObject) {
	                        this.iframe.contentWindow.dcsObject.destroy();
	                    }
	                }
	            });
	            return false;
	        });


	        $(".uploadqt").on('click', function () {
	            var title, url, $obj = $(this);
	            var id = $obj.attr('data-id');
	            var fb = $obj.attr('data-dap');
	            var width = 1000;
	            var height = 546;
	            if (fb == 'bz') {
	                title = '包装上传';
	            } else if (fb == 'sm') {
	                title = '说明书上传';

	            } else if (fb == 'cj') {
	                title = '厂家证照上传';
	            }
	            var url = '/base/drugupload.aspx';
	            $.dialog({
	                title: title,
	                width: 965,
	                height: 533,
	                height: height,
	                content: 'url:' + url + '?id=' + id + '&fb=' + fb,
	                padding: 0,
	                lock: true,
	                fixed: true,
	                min: false,
	                max: false
	            });
	            return false;
	        });

	        $('.number').on('click', function () {
	            var value = $(this).text();
	            var id = $(this).attr('data-id');
	            var fb = $obj.attr('data-dap');
	            $.dialog.prompt('请输入新的档案号：',
					function (val) {
					    if (val.length == 0) {
					        return false;
					    }
					    if (val == value) {
					        return false;
					    }
					    $.ajax({
					        url: '/member/drug/act/number.aspx',
					        type: "post",
					        data: { number: val, id: id },
					        dataType: 'json',
					        success: function (data) {
					            if (data.code == 1) {
					                $.dialog.tips(data.msg, 1, 'success.gif', function () {
					                    window.location.reload();
					                });
					            } else {
					                $.dialog.tips(data.msg ? data.msg : '抱歉，系统错误，请稍后再试！', 2, 'error.gif');
					                return false;
					            }
					        },
					        error: function () {
					            $.dialog.tips('抱歉，系统错误，请稍后再试！', 2, 'error.gif');
					        }
					    });
					},
					value
				);
	            return false;
	        });
	        $('.reminder').on('click', function () {
	            var id = $(this).attr('data-id');
	            $.ajax({
	                url: '/member/drug/act/reminder.html',
	                type: "post",
	                data: { id: id },
	                dataType: 'json',
	                success: function (data) {
	                    if (data.code == 1) {
	                        $.dialog.tips(data.msg, 1, 'success.gif', function () {
	                            window.location.reload();
	                        });
	                    } else {
	                        $.dialog.tips(data.msg ? data.msg : '抱歉，系统错误，请稍后再试！', 2, 'error.gif');
	                        return false;
	                    }
	                },
	                error: function () {
	                    $.dialog.tips('抱歉，系统错误，请稍后再试！', 2, 'error.gif');
	                }
	            });
	            return false;
	        });



	        $('.pjzc').on('click', function () {
	            $.dialog.tips('数据加载中...', 1000, 'loading.gif');
	            $.ajax({
	                url: '/search/dump.html',
	                dataType: 'json',
	                success: function (data) {
	                    if (data.code == 1) {
	                        $.dialog.tips(data.msg, 1, 'success.gif', function () {
	                            window.location.reload();
	                        });
	                    } else {
	                        $.dialog.tips(data.msg ? data.msg : '抱歉，系统错误，请稍后再试！', 2, 'error.gif');
	                        return false;
	                    }
	                },
	                error: function () {
	                    $.dialog.tips('抱歉，系统错误，请稍后再试！', 2, 'error.gif');
	                }
	            });
	            return false;
	        });
	        $('.alert-warning').on('click', 'a.close', function () {
	            $(this).closest('div.alert-warning').remove();
	            return false;
	        });
	    });
	</script>
<script type="text/javascript">
    $(document).ready(window.onresize = function () {
        //var whe = $(window).height();
        //$(".Member_left").css("height",whe-72);
        $('body').on('click', '.ajax-url', function () {
            var msg = '确定要执行该操作吗？';
            var url = $(this).attr('href');
            if ($(this).attr('data-msg')) {
                msg = $(this).attr('data-msg');
            }
            $.dialog.confirm(msg, function () {
                $.ajax({
                    url: url,
                    type: "post",
                    data: {},
                    dataType: 'json',
                    success: function (data) {
                        if (data.code == 1) {
                            $.dialog.tips(data.msg ? data.msg : '操作成功', 2, 'success.gif', function () {
                                window.location.reload();
                            });
                        } else {
                            $.dialog.tips(data.msg ? data.msg : '抱歉，系统错误，请稍后再试！', 2, 'error.gif');
                        }
                    },
                    error: function () {
                        $.dialog.tips('抱歉，系统错误，请稍后再试！', 2, 'error.gif');
                    }
                });
            });
            return false;
        });
        $('.logout').on('click', function () {
            var href = $(this).attr('href');
            $.dialog.confirm('您确定要退出登录吗？', function () {
                window.location.href = href;
            });
            return false;
        });
        if (!('placeholder' in document.createElement('input'))) {
            $('input[placeholder],textarea[placeholder]').each(function () {
                var that = $(this),
                text = that.attr('placeholder');
                if (that.val() === "") {
                    that.val(text).addClass('placeholder');
                }
                that.focus(function () {
                    if (that.val() === text) {
                        that.val("").removeClass('placeholder');
                    }
                })
                .blur(function () {
                    if (that.val() === "") {
                        that.val(text).addClass('placeholder');
                    }
                })
                .closest('form').submit(function () {
                    if (that.val() === text) {
                        that.val('');
                    }
                });
            });
        }
    });
</script>
</body>
</html>
